﻿using Dapper_Core.Common;
using Dapper_Core.Model;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;

namespace Dapper_Core.Web
{
    public class BaseHelper
    {
        public static bool HasPermission(string menuCode)
        {
            try
            {
                List<string> menus = SessionUtility.GetSessionData<List<string>>(SessionKey.GetAllMenusCodeKey());
                if (menus == null || menus.Count < 1) return false;
                if (menus.Where(item => item == menuCode).Count() > 0) return true;
                return false;
            }
            catch (Exception)
            {
                return false;
            }
        }
    }
}
